<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="js/bootstrap.min.css">
    <script src="js/jquery-1.12.4.js"></script>
    <script src="js/bootstrap.min.js"></script>
</head>
<body>

<nav class="navbar navbar-default" th:fragment="topbar">
    <div class="container-fluid">
        <!-- Brand and toggle get grouped for better mobile display -->
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
        </div>
        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
            <ul class="nav navbar-nav">
                <li class="active" th:class="${urlActive =='home'?'active':''}" style="margin-right: 10px;margin-left: 10px"><a class="navbar-brand" th:href="@{/home}">首页</a></li>
                <li class="topMenu" th:class="${urlActive =='fire'?'active':''}" style="margin-right: 10px;margin-left: 10px"><a th:href="@{/fire}" class="navbar-brand">火灾信息<span class="sr-only">(current)</span></a></li>
                <li class="topMenu" th:class="${urlActive =='sensor'?'active':''}"><a th:href="@{/sensor}" class="navbar-brand" style="margin-right: 10px;margin-left: 10px">终端信息</a></li>
            </ul>
            <form class="navbar-form navbar-left" th:if="${urlActive == 'sensor'}" th:action="@{/sensor}" method="post">
                 <div class="form-group">
                                <input type="text" name="search" class="form-control" placeholder="Search">
                 </div>
                   <button type="submit" class="btn btn-default">Submit</button>
            </form>
            <ul class="nav navbar-nav navbar-right">
                <li><h4 style="margin-top: 15px">欢迎您，</h4></li>
                <li class="dropdown">
                  <a class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">[[${session.username}]]<span class="caret"></span></a>
                    <ul class="dropdown-menu">
                        <li><a data-toggle="modal" data-target="#myModal">修改密码</a></li>
                        <li role="separator" class="divider"></li>
                        <li><a th:href="@{/logout}">退出登录</a></li>
                    </ul>
                </li>
            </ul>
        </div>
        <form method="post" th:action="@{/user}" class="form-horizontal" role="form" >
            <input type="hidden" name="urlActive" th:value="${urlActive}">
            <input type="hidden" id="myMsg" name="myMsg" th:value="${pwdMsg}">
            <div class="modal fade" id="myModal"  tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
                <!--  定义模态框，过渡效果为淡入，id为myModal,tabindex=-1可以禁用使用tab切换，aria-labelledby用于引用模态框的标题，aria-hidden=true保持模态框在触发前窗口不可见  -->
                <div class="modal-dialog">
                    <!--  显示模态框对话框模型（若不写下一个div则没有颜色）  -->
                    <div class="modal-content">
                        <!--  显示模态框白色背景，所有内容都写在这个div里面  -->
                        <div class="btn-info modal-header">
                            <!--  模态框标题  -->
                            <button type="button" class="close" data-dismiss="modal">&times;</button>
                            <!--  关闭按钮  -->
                            <h4>修改密码</h4>
                            <!--  标题内容  -->
                        </div>

                        <div class="modal-body">
                            <!--  模态框内容，我在此处添加一个表单 -->
                            <form class="form-horizontal" role="form" method="post">
                                <div class="form-group">
                                    <label  class="col-sm-4 control-label">旧密码</label>
                                    <div class="col-sm-6">
                                        <input type="password" th:required="required" th:oninvalid="setCustomValidity('请输入您的旧密码')" th:oninput="setCustomValidity('')"  name="password" class="form-control well" placeholder="请输入旧密码"/>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label th:for="newPw" class="col-sm-4 control-label">新密码</label>
                                    <div class="col-sm-6">
                                        <input type="password" th:required="required" th:oninvalid="setCustomValidity('请输入您的新密码')" th:oninput="setCustomValidity('')"  name="newPw" class="form-control well" placeholder="请输入新密码"/>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label th:for="newPw2" class="col-sm-4 control-label">确认密码</label>
                                    <div class="col-sm-6">
                                        <input type="password" th:required="required" th:oninvalid="setCustomValidity('请再次输入您的新密码')" th:oninput="setCustomValidity('')"  name="newPw2" class="form-control well" placeholder="请确认新密码"/>
                                    </div>
                                </div>
                            </form>
                        </div>

                        <div class="modal-footer">
                            <!--  模态框底部样式，一般是提交或者确定按钮 -->
                            <button type="submit" class="btn btn-info">确定</button>
                            <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                        </div>
                    </div><!-- /.modal-content -->
                </div>
            </div> <!-- /.modal -->
        </form>
    </div>
    </div>
</nav>
<nav th:fragment="buttombar">
    <div style="background-color: #e2e2e2;height: 110px;width: 100%;position: relative">
        <div style="position: absolute;width: 300px;height: 70px;margin-left: 530px">
            <p style="text-align: center;margin-top: 30px;color: black">
                <a>关于我们</a>&nbsp;|&nbsp;<a>联系我们</a>&nbsp;|&nbsp;<a>推荐网站</a>&nbsp;|&nbsp;<a>商务合作</a><br>
                版权所有：袁广东
                @2019-2020
            </p>
        </div>
    </div>
</nav>
</body>
</html>